//
//  Column2HeaderView.m
//  MY Project For Sport
//
//  Created by dllo on 16/3/3.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "Column2HeaderView.h"
#import <DKNightVersion.h>
@interface Column2HeaderView ()

@property (nonatomic, retain)UIVisualEffectView *visual;
@end

@implementation Column2HeaderView
-(void)dealloc {
    
    [_backgroundView release];
    [_labelForName release];
    [_labelForSum release];
    [_image release];
    [_number release];
    [_visual release];
    [super dealloc];

}

- (instancetype)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];
    
    if (self) {
       
        [self createSubview];

    }
    
    return self;
}

- (void)createSubview {

    self.backgroundView = [[UIImageView alloc] initWithFrame:self.frame];
    [self addSubview:self.backgroundView];
    [_backgroundView release];
  //  self.backgroundView.backgroundColor = [UIColor redColor];
    
    self.visual = [[UIVisualEffectView alloc] initWithFrame:self.frame];
    [self.backgroundView addSubview:self.visual];
    [_visual release];
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:1];
    self.visual.effect = blur;
    
    self.image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.height / 2.5, self.frame.size.height / 2.5)];
    self.image.center = CGPointMake(self.center.x, self.center.y - self.frame.size.height / 5);
    [self addSubview:self.image];
    [_image release];
    self.image.layer.cornerRadius = self.frame.size.height / 5;
    self.image.layer.masksToBounds = YES;
    //self.image.backgroundColor = [UIColor orangeColor];
    
    self.labelForName = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3, self.center.y - self.frame.size.height / 2.5 + self.frame.size.height / 2.5 + 5, self.frame.size.width / 3, 30)];
    [self addSubview:self.labelForName];
    [_labelForName release];
    self.labelForName.font = [UIFont systemFontOfSize:18];
   // self.labelForName.backgroundColor = [UIColor blueColor];
    self.labelForName.textAlignment = NSTextAlignmentCenter;
    self.labelForName.textColor = [UIColor whiteColor];
    
    self.labelForSum = [[UILabel alloc] initWithFrame:CGRectMake(20, self.center.y - self.frame.size.height / 2.5 + self.frame.size.height / 2.5 + 40, self.frame.size.width - 40, 30)];
    [self addSubview:self.labelForSum];
    [_labelForSum release];
   // self.labelForSum.backgroundColor = [UIColor greenColor];
    self.labelForSum.textAlignment = NSTextAlignmentCenter;
    self.labelForSum.textColor = [UIColor whiteColor];
    self.labelForSum.font = [UIFont systemFontOfSize:14];

    self.number = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3, self.center.y - self.frame.size.height / 2.5 + self.frame.size.height / 2.5 + 75, self.frame.size.width / 3, 20)];
    [self addSubview:self.number];
    [_number release];
    //self.number.backgroundColor = [UIColor yellowColor];
    self.number.textAlignment = NSTextAlignmentCenter;
    self.number.font = [UIFont systemFontOfSize:16];
    self.number.textColor = [UIColor whiteColor];

}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
